//
//  ViewController.m
//  TestDemo
//
//  Created by FelixYin on 2020/4/23.
//  Copyright © 2020 FelixYin. All rights reserved.
//

#import "ViewController.h"
#import "AppDelegate.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    [self addFlutterVCViewToViewController];

}

- (void) addFlutterVCViewToViewController{
//    UIScreen *screen = [UIScreen mainScreen];
    //需要设置一个大小
    FlutterEngine *engine = ((AppDelegate *)[UIApplication sharedApplication].delegate).flutterEngine;
    FlutterViewController *vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil];
    vc.view.frame = CGRectMake(0, 0, 300, 600);
    [self.view addSubview:vc.view];
}


- (IBAction) enterFlutterVC:(UIButton *) btn{
    FlutterEngine *engine = ((AppDelegate *)[UIApplication sharedApplication].delegate).flutterEngine;
    FlutterViewController *vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil];
    vc.modalPresentationStyle = UIModalPresentationFullScreen;
    [self presentViewController:vc animated:YES completion:^{
        
    }];
}


@end
